
import {defineStore} from "pinia";
import {v4} from "uuid";



export const webSocketState = defineStore('websocket',()=>{

    const getDeviceId = ()=>{
        let id = localStorage.getItem('webSocketId')
        if (!id) {
            id = v4()
            localStorage.setItem('webSocketId',id)
        }
        return id
    }

    const deviceId = getDeviceId()



    return{
        webSocketState,
        deviceId,
        getDeviceId
    }
})
